home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C++ für Kids
/
C++ for kids.iso
/
SETUP
/
US
/
CBUILDER
/
DATA.Z
/
LIMITS.H
< prev
next >
Wrap
C/C++ Source or Header
|
1997-02-13
|
37KB
|
1,065 lines
/* limits.h
Defines implementation specific limits on type values.
*/
/*
* C/C++ Run Time Library - Version 8.0
*
* Copyright (c) 1987, 1997 by Borland International
* All Rights Reserved.
*
*/
#if !defined(__USING_STD_NAMES__)
#ifndef __LIMITS_H
#define __LIMITS_H
#if !defined(___DEFS_H)
#include <_defs.h>
#endif
#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 2 /* max. # bytes in multibyte char */
#define SCHAR_MIN (-128) /* minimum signed char value */
#define SCHAR_MAX 127 /* maximum signed char value */
#define UCHAR_MAX 255 /* maximum unsigned char value */
#if ('\x80' < 0)
#define CHAR_MIN SCHAR_MIN /* minimum char value */
#define CHAR_MAX SCHAR_MAX /* maximum char value */
#else
#define CHAR_MIN 0
#define CHAR_MAX UCHAR_MAX
#endif
#define SHRT_MIN (-32767-1) /* minimum signed short value */
#define SHRT_MAX 32767 /* maximum signed short value */
#define USHRT_MAX 65535U /* maximum unsigned short value */
#define LONG_MIN (-2147483647L-1) /* minimum signed long value */
#define LONG_MAX 2147483647L /* maximum signed long value */
#define ULONG_MAX 4294967295UL /* maximum unsigned long value */
#if defined(__FLAT__)
#define _I64_MIN (-9223372036854775807i64-1) /* minimum signed __int64 value */
#define _I64_MAX 9223372036854775807i64 /* maximum signed __int64 value */
#define _UI64_MAX 18446744073709551615ui64 /* maximum unsigned __int64 value */
#endif
#if !defined(__FLAT__)
#define INT_MIN SHRT_MIN /* minimum signed int value */
#define INT_MAX SHRT_MAX /* maximum signed int value */
#define UINT_MAX USHRT_MAX /* maximum unsigned int value */
#else
#define INT_MIN LONG_MIN
#define INT_MAX LONG_MAX
#define UINT_MAX ULONG_MAX
#endif
#if defined(__FLAT__) && defined(_POSIX_)
#define _POSIX_ARG_MAX 4096
#define _POSIX_CHILD_MAX 6
#define _POSIX_LINK_MAX 8
#define _POSIX_MAX_CANON 255
#define _POSIX_MAX_INPUT 255
#define _POSIX_NAME_MAX 14
#define _POSIX_NGROUPS_MAX 0
#define _POSIX_OPEN_MAX 16
#define _POSIX_PATH_MAX 255
#define _POSIX_PIPE_BUF 512
#define _POSIX_SSIZE_MAX 32767
#define _POSIX_STREAM_MAX 8
#define _POSIX_TZNAME_MAX 3
#define ARG_MAX (16384 - 256) /* 16k-(heap overhead+safety) */
#define CHILD_MAX 32
#define LINK_MAX _POSIX_LINK_MAX
#define MAX_CANON _POSIX_MAX_CANON
#define MAX_INPUT _POSIX_MAX_INPUT
#define NAME_MAX 255
#define NGROUPS_MAX 16
#define OPEN_MAX 32
#define PATH_MAX 512
#define PIPE_BUF _POSIX_PIPE_BUF
#define SSIZE_MAX _POSIX_SSIZE_MAX
#define STREAM_MAX 20
#define TZNAME_MAX 10
#endif /* POSIX */
#endif /* __LIMITS_H */
#else /* __USING_STD_NAMES__ */
#ifndef __STD_LIMITS
#define __STD_LIMITS
/***************************************************************************
*
* limits - Declarations for the Standard Library limits class
*
* $Id: limits,v 1.42 1995/09/29 01:06:31 smithey Exp $
*
***************************************************************************
*
* (c) Copyright 1994, 1995 Rogue Wave Software, Inc.
* ALL RIGHTS RESERVED
*
* The software and information contained herein are proprietary to, and
* comprise valuable trade secrets of, Rogue Wave Software, Inc., which
* intends to preserve as trade secrets such software and information.
* This software is furnished pursuant to a written license agreement and
* may be used, copied, transmitted, and stored only in accordance with
* the terms of such license and with the inclusion of the above copyright
* notice. This software and information or any other copies thereof may
* not be provided or otherwise made available to any other person.
*
* Notwithstanding any other lease or license that may pertain to, or
* accompany the delivery of, this computer software and information, the
* rights of the Government regarding its use, reproduction and disclosure
* are as set forth in Section 52.227-19 of the FARS Computer
* Software-Restricted Rights clause.
*
* Use, duplication, or disclosure by the Government is subject to
* restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
* Technical Data and Computer Software clause at DFARS 252.227-7013.
* Contractor/Manufacturer is Rogue Wave Software, Inc.,
* P.O. Box 2328, Corvallis, Oregon 97339.
*
* This computer software and information is distributed with "restricted
* rights." Use, duplication or disclosure is subject to restrictions as
* set forth in NASA FAR SUP 18-52.227-79 (April 1985) "Commercial
* Computer Software-Restricted Rights (April 1985)." If the Clause at
* 18-52.227-74 "Rights in Data General" is specified in the contract,
* then the "Alternate III" clause applies.
*
**************************************************************************/
#include <stdcomp.h>
#include <stddefs.h>
#ifndef RWSTD_NO_NEW_HEADER
#include <cfloat>
#include <climits>
#else
#include <float.h>
#include <limits.h>
#endif
//
// Hack to get around some <math.h>s defining an exception structure.
//
#define exception math_exception
#ifndef RWSTD_NO_NEW_HEADER
#include <cmath>
#else
#include <math.h>
#endif
//
// Undo the hack.
//
#undef exception
//
// WARNING: this is a hack to get around MSVC's complex
//
#ifdef _MSC_VER
#ifdef complex
#undef complex
#endif
#endif
#ifndef RWSTD_NO_NAMESPACE
namespace std {
#endif
enum float_round_style
{
round_indeterminable = -1,
round_toward_zero = 0,
round_to_nearest = 1,
round_toward_infinity = 2,
round_toward_neg_infinity = 3
};
template <class T>
class numeric_limits
{
public:
static const bool is_specialized;
static inline T min () { return (T) 0; }
static inline T max () { return (T) 0; }
static const int digits;
static const int digits10;
static const bool is_signed;
static const bool is_integer;
static const bool is_exact;
static const int radix;
static inline T epsilon () { return (T) 0; }
static inline T round_error () { return (T) 0; }
static const int min_exponent;
static const int min_exponent10;
static const int max_exponent;
static const int max_exponent10;
static const bool has_infinity;
static const bool has_quiet_NaN;
static const bool has_signaling_NaN;
static const bool has_denorm;
static inline T infinity () { return (T) 0; }
static inline T quiet_NaN () { return (T) 0; }
static inline T signaling_NaN () { return (T) 0; }
static inline T denorm_min () { return min(); }
static const bool is_iec559;
static const bool is_bounded;
static const bool is_modulo;
static const bool traps;
static const bool tinyness_before;
static const float_round_style round_style;
};
#ifndef RWSTD_NO_TEMPLATE_SPECIALIZATION
template <class T>
const bool numeric_limits<T>::is_specialized = false;
template <class T>
const int numeric_limits<T>::digits = 0;
template <class T>
const int numeric_limits<T>::digits10 = 0;
template <class T>
const bool numeric_limits<T>::is_signed = false;
template <class T>
const bool numeric_limits<T>::is_integer = false;
template <class T>
const bool numeric_limits<T>::is_exact = false;
template <class T>
const int numeric_limits<T>::radix = 0;
template <class T>
const int numeric_limits<T>::min_exponent10 =0;
template <class T>
const int numeric_limits<T>::max_exponent1